#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int n, m;
    char s[100];
    scanf("%d%d\n%s", &n, &m, s);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        char c1, c2;
        scanf("%d%d %c %c", &a, &b, &c1, &c2);
        for (int j = a - 1; j <= b - 1; j++)
        {
            if (s[j] == c1)
            {
                s[j] = c2;
            }
        }
    }
    printf("%s", s);
    return 0;
}